package com.winit.openapi.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.winit.openapi.model.RequestMsg;
import com.winit.openapi.model.ResponseMsg;
import com.winit.wms.spi.isp.MeasureService;
import com.winit.wms.spi.isp.command.assemblyline.AcceptInspectionInfoCommand;

/**
 * HSJ Controller TODO long.yue: Change to the actual description of this class
 * 
 * @version Revision History
 * 
 * <pre>
 * Author     Version       Date        Changes
 * long.yue    1.0           2015年1月10日     Created
 * 
 * </pre>
 * @since 1.
 */
@Controller
@RequestMapping(value = "/hsj")
public class HSJController extends BaseController {

    @Resource
    private MeasureService measureService;

    public void setMeasureService(MeasureService measureService) {
        this.measureService = measureService;
    }

    @RequestMapping(value = "/measure/acceptInspectionInfo")
    public String acceptInspectionInfo(@ModelAttribute RequestMsg requestMsg, @ModelAttribute ResponseMsg responseMsg) {
        // 获取参数
        JSONObject json = JSONObject.parseObject(requestMsg.getData().toString());
        JSONObject arg = json.getJSONObject("arg");
        AcceptInspectionInfoCommand command = JSON.toJavaObject(arg, AcceptInspectionInfoCommand.class);
        measureService.acceptInspectionInfo(command);
        return SUCCESS;
    }
}
